package com.water.service.impl;

import com.water.dao.SySurchargeDao;
import com.water.entity.SySurcharge;
import com.water.service.SySurchargeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SySurcharge)表服务实现类
 *
 * @author makejava
 * @since 2020-12-14 19:19:04
 */
@Service("sySurchargeService")
public class SySurchargeServiceImpl implements SySurchargeService {
    @Resource
    private SySurchargeDao sySurchargeDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SySurcharge queryById(Integer id) {
        return this.sySurchargeDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<SySurcharge> queryAllByLimit(int offset, int limit) {
        return this.sySurchargeDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param sySurcharge 实例对象
     * @return 实例对象
     */
    @Override
    public SySurcharge insert(SySurcharge sySurcharge) {
        this.sySurchargeDao.insert(sySurcharge);
        return sySurcharge;
    }

    /**
     * 修改数据
     *
     * @param sySurcharge 实例对象
     * @return 实例对象
     */
    @Override
    public SySurcharge update(SySurcharge sySurcharge) {
        this.sySurchargeDao.update(sySurcharge);
        return this.queryById(sySurcharge.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sySurchargeDao.deleteById(id) > 0;
    }
}